package com.cennavi.bigdata.baotou.scripts;

/**
 * Created by cennavi on 2017/10/28.
 */
public class KakouTraffic {

    /**
     * 根据传入的时间字符串将时间转换成0,5时间格式的字符串
     * @param date
     * @return
     */
    public String  getMinute(String  date){
        String[] split = date.split(":");
        int s  = Integer.parseInt(split[split.length - 2]);
        StringBuffer time = new StringBuffer();
        if(s%5!=0){
            s=s-s%5;
            if (s<10){
                time.append(split[0] + ":" + "0" + s + ":" + "00");

            }else {
                time.append(split[0] + ":" + s + ":" + "00");
            }
            return time.toString();
        }else {
            return date;
        }

    }
}
